/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bs.Beans;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Bone
 */
@Entity
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Transportadora.findAll", query = "SELECT t FROM Transportadora t")})
public class Transportadora implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer id;
    @Column(name = "DATA_CADASTRO")
    @Temporal(TemporalType.DATE)
    private Date dataCadastro;
    @Lob
    @Column(length = 65535)
    private String observacao;
    @OneToMany(mappedBy = "idTransportadora")
    private List<OrcamentoPedidoVendaCab> orcamentoPedidoVendaCabList;
    @JoinColumn(name = "ID_CONTABIL_CONTA", referencedColumnName = "ID")
    @ManyToOne
    private ContabilConta idContabilConta;
    @JoinColumn(name = "ID_PESSOA", referencedColumnName = "ID", nullable = false)
    @ManyToOne(optional = false)
    private Pessoa idPessoa;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTransportadora")
    private List<FreteVenda> freteVendaList;
    @OneToMany(mappedBy = "idTransportadora")
    private List<NfeTransporte> nfeTransporteList;
    @OneToMany(mappedBy = "idTransportadora")
    private List<VendaCabecalho> vendaCabecalhoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTransportadora")
    private List<TransportadoraMunicipio> transportadoraMunicipioList;

    public Transportadora() {
    }

    public Transportadora(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDataCadastro() {
        return dataCadastro;
    }

    public void setDataCadastro(Date dataCadastro) {
        this.dataCadastro = dataCadastro;
    }

    public String getObservacao() {
        return observacao;
    }

    public void setObservacao(String observacao) {
        this.observacao = observacao;
    }

    @XmlTransient
    public List<OrcamentoPedidoVendaCab> getOrcamentoPedidoVendaCabList() {
        return orcamentoPedidoVendaCabList;
    }

    public void setOrcamentoPedidoVendaCabList(List<OrcamentoPedidoVendaCab> orcamentoPedidoVendaCabList) {
        this.orcamentoPedidoVendaCabList = orcamentoPedidoVendaCabList;
    }

    public ContabilConta getIdContabilConta() {
        return idContabilConta;
    }

    public void setIdContabilConta(ContabilConta idContabilConta) {
        this.idContabilConta = idContabilConta;
    }

    public Pessoa getIdPessoa() {
        return idPessoa;
    }

    public void setIdPessoa(Pessoa idPessoa) {
        this.idPessoa = idPessoa;
    }

    @XmlTransient
    public List<FreteVenda> getFreteVendaList() {
        return freteVendaList;
    }

    public void setFreteVendaList(List<FreteVenda> freteVendaList) {
        this.freteVendaList = freteVendaList;
    }

    @XmlTransient
    public List<NfeTransporte> getNfeTransporteList() {
        return nfeTransporteList;
    }

    public void setNfeTransporteList(List<NfeTransporte> nfeTransporteList) {
        this.nfeTransporteList = nfeTransporteList;
    }

    @XmlTransient
    public List<VendaCabecalho> getVendaCabecalhoList() {
        return vendaCabecalhoList;
    }

    public void setVendaCabecalhoList(List<VendaCabecalho> vendaCabecalhoList) {
        this.vendaCabecalhoList = vendaCabecalhoList;
    }

    @XmlTransient
    public List<TransportadoraMunicipio> getTransportadoraMunicipioList() {
        return transportadoraMunicipioList;
    }

    public void setTransportadoraMunicipioList(List<TransportadoraMunicipio> transportadoraMunicipioList) {
        this.transportadoraMunicipioList = transportadoraMunicipioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transportadora)) {
            return false;
        }
        Transportadora other = (Transportadora) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bs.Beans.Transportadora[ id=" + id + " ]";
    }
    
}
